<?php
/**
 * Test suite for Person
 * Created on Feb 27, 2008
 * @author Taylor Talmage
 */

  //first I include the php file I'm testing
 include_once(dirname(__FILE__).'/../database/Person.php');
 class testPerson extends UnitTestCase {
      function testPersonModule() {
 //I need to make an object to test. This is just dummy data.
 $myPerson = new Person("Taylor","Talmage","928 SU","Brunswick","ME",04011,
 2074415902,2072654046,"ttalmage@bowdoin.edu","applicant,volunteer,sub","inactive","","","","no","no","no","", "", "", "", "",
 "Mon9-12, Tue9-12, Wed12-3", "", "", "02-19-89", "03-14-08",
"this is one of my notes","this is a cool note","this is another note","Taylor2074415902");

 //first assertion - check that a getter is working from the superconstructor's initialized data
 $this->assertTrue($myPerson->get_first_name()=="Taylor");

 //as of construction, we should NOT have applied for the position of Manager
 $this->assertTrue(!in_array("manager", $myPerson->get_type()));
 //now let's add it
 $myPerson->add_type("manager");
 $this->assertTrue(in_array("manager", $myPerson->get_type()));
 //now we should remove it
 $myPerson->remove_type("manager");
 $this->assertTrue(!in_array("manager", $myPerson->get_type()));

 //So if all $this->assertTrue's cleared, running this script will output testPersons complete".
 $this->assertTrue($myPerson->get_last_name() !== "notMyLastName");

 // Test availability and scheduling functions
 $myPerson->add_availability("Tue9-12");
 $myPerson->add_availability("Tue12-3");
 $myPerson->add_availability("Tue3-6");
 $myPerson->add_availability("Tue6-9");
 $myPerson->add_availability("Wed9-12");
 //should be available since we just added it.
 $this->assertTrue($myPerson->is_available("Wed9-12"));
 //now let's remove it and test
 $myPerson->remove_availability("Wed9-12");
 $this->assertTrue(!$myPerson->is_available("Wed9-12"));
 
 //testing new get/set functions
 $myPerson->set_status("active");
 $this->assertTrue($myPerson->get_status()=="active");
 $myPerson->set_employer("FakeCorp");
 $this->assertTrue($myPerson->get_employer()=="FakeCorp");
 $myPerson->set_contact("Joe");
 $this->assertTrue($myPerson->get_contact()=="Joe");
 $myPerson->set_contact_phone("123-456-7890");
 $this->assertTrue($myPerson->get_contact_phone()=="123-456-7890");

 echo("testPerson complete");
      }
 }

?>
